package com.ruoyi.sentinel;
/**
 * @projectName: RuoYi-Cloud
 * @package: PACKAGE_NAME
 * @className: com.ruoyi.sentinel.TestUserController
 * @author: Biwl
 * @description: TODO
 * @date: 2024/5/4 16:36
 * @version: 1.0
 */

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class TestUserController {
    @Autowired
    private IUserService userService;

    @GetMapping("/user/info")
    public Object info()
    {
        return "{\"username\":\"admin\",\"password\":\"admin123\"}";
    }

    @GetMapping("/info/{username}")
    public Object info(@PathVariable("username") String username)
    {
        try {
            Thread.sleep(5000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return userService.selectUserByName(username);
    }

    @GetMapping("/user/gualian")
    public Object gualian() {
        return "关联限流正常";
    }
    @GetMapping("/user/lianlu1")
    public Object lianlu1(){
        return userService.selectUserByName("admin");
    }
    @GetMapping("/user/lianlu2")
    public Object lianlu2(){
        return userService.selectUserByName("ry");
    }
}